package com.zhou.juc.test01_thread;

/**
 * @author zhouyanxiang
 * @create 2020-06-2020/6/19-18:34
 */
public class T04_ThreadState {

    private static class MyThread extends Thread{
        @Override
        public void run(){
            for (int i = 0; i < 10; i++) {
                System.out.println("----- MyThread ----");
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(" i = " + i);
            }
        }
    }

    public static void main(String[] args) {
        Thread T = new MyThread();

        System.out.println(T.getState());

        T.start();
        try {
            T.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println(T.getState());
    }
}
